using System;
using System.Collections.Generic;

namespace FwkLight.Domain.Fetching
{
  public class WaitForFilter<EntityType, R> : IWaitForFilter<EntityType, R>
  {
    private readonly string _propertyName;
    private readonly IMultiCriteriaFetcher<EntityType> _fetcher;
    private readonly IFetchingPart<EntityType> _fetchingPart;

    public WaitForFilter ( string propertyName, IMultiCriteriaFetcher<EntityType> fetcher, IFetchingPart<EntityType> fetchingPart )
    {
      _propertyName = propertyName;
      _fetcher = fetcher;
      _fetchingPart = fetchingPart;
    }

    public IMultiCriteriaFetcher<EntityType> Eq ( R value )
    {
      _fetchingPart.Filters.Add(new FetchingFilterEq(_propertyName, value, _fetchingPart));
      return _fetcher;
    }

		public IMultiCriteriaFetcher<EntityType> NotEq(R value)
		{
			_fetchingPart.Filters.Add(new FetchingFilterNotEq(_propertyName, value, _fetchingPart));
			return _fetcher;
		}

    public IMultiCriteriaFetcher<EntityType> Gt ( R value )
    {
      _fetchingPart.Filters.Add(new FetchingFilterGt(_propertyName, value, _fetchingPart));
      return _fetcher;
    }

    public IMultiCriteriaFetcher<EntityType> IsNull()
    {
      _fetchingPart.Filters.Add(new FetchingFilterIsNull(_propertyName, _fetchingPart));
      return _fetcher;
    }

    public IMultiCriteriaFetcher<EntityType> Le ( R value )
    {
      _fetchingPart.Filters.Add(new FetchingFilterLe(_propertyName, value, _fetchingPart));
      return _fetcher;
    }

    public IMultiCriteriaFetcher<EntityType> In ( ICollection<R> values )
    {
      _fetchingPart.Filters.Add(new FetchingFilterIn(_propertyName, values, _fetchingPart));
      return _fetcher;
    }

    public IMultiCriteriaFetcher<EntityType> Ge ( R value )
    {
      _fetchingPart.Filters.Add(new FetchingFilterGe(_propertyName, value, _fetchingPart));
      return _fetcher;
    }
  }
}